from appium import webdriver
from time import sleep
from appium.webdriver.common.appiumby import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# 构建desired_caps
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '7'
desired_caps['deviceName'] = '127.0.0.1:62001'
desired_caps['app'] = r'E:\nmon\apk\mymoney.apk'
desired_caps['appPackage'] = r'com.mymoney'
desired_caps['appActivity'] = r'com.mymoney.biz.splash.SplashScreenActivity'
desired_caps['noReset'] = True

driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub',desired_caps)
driver.implicitly_wait(10)
sleep(8)

# 进入记账本界面
# 加显示等待
# 1. 导包
# 2. 写语句
# menu_loc = driver.find_element(By.ID,'com.mymoney:id/switch_suite_btn')
# # 显式等待
# ele = WebDriverWait(driver, 30, 0.5).until(EC.presence_of_element_located(menu_loc))
# ele.click()
# sleep(1)

# # 点击同意
# driver.find_element(By.ID,'com.mymoney:id/sui_dialog_positive_btn_style1').click()
# # 点击选账本
# driver.find_element(By.ID,'com.mymoney:id/select_template_btn').click()
#
# # 点击跳过
# driver.find_element(By.ID,'com.mymoney:id/bottom_skip_tv').click()


